#include <stdio.h>
#include <iostream>
#include <vector>
using namespace std;
int calculate(string s);
int main(){
	cout << calculate("5-2");
	return 0;
} 

    int calculate(string s) {
        vector<int> num;
        vector<char> cal;
        for(int i = 0;i<s.length();i++){
            if(s[i]==' ') 
                continue;
            else if(s[i] =='+' || s[i] =='-' || s[i] =='*' || s[i] =='/')
                cal.push_back(s[i]);
            else{
                int t = s[i]-'0';
                for(;;){
                    if(i+1<s.length() && s[i+1]<='9' && s[i+1]>='0'){
                        t = t*10 + (s[i+1]-'0'); 
                        i++;
                    }else{
                        break;
                    }
                }
                num.push_back(t);
			}
        }
        for(int i = 0 ; i<cal.size() ; i++){
            if(cal[i]=='/'){
                num[i] = num[i]/num[i+1];
                num.erase(num.begin()+i+1);
                cal.erase(cal.begin()+i);
                i--;
            }else if(cal[i]=='*'){
                num[i] = num[i]*num[i+1];
                num.erase(num.begin()+i+1);
                cal.erase(cal.begin()+i);
                i--;
            }
        }
        for(int i = 0 ; i<cal.size() ; i++){
            if(cal[i]=='+'){
                num[i] = num[i]+num[i+1];
                num.erase(num.begin()+i+1);
                cal.erase(cal.begin()+i);
                i--;
            }else if(cal[i]=='-'){
                num[i] = num[i]-num[i+1];
                num.erase(num.begin()+i+1);
                cal.erase(cal.begin()+i);
                i--;
            }
        }
        return num[0];
    }
